export const prodSortOptions = [
  {
    value: 1,
    label: "产成品",
  },
  {
    value: 2,
    label: "中间品",
  },
  {
    value: 3,
    label: "原料",
  },
];

export const statusOptions = [
  {
    value: 1,
    label: "启用",
  },
  {
    value: 9,
    label: "禁用",
  },
];

// 性能类型
export const performSortOptions = [
  {
    value: "S",
    label: "结构",
  },
  {
    value: "P",
    label: "性能",
  },
  {
    value: "A",
    label: "老化",
  },
];
// 设备类型
export const deviceOptions = [
  {
    value: "生产",
    label: "生产",
  },
  {
    value: "检测",
    label: "检测",
  },
];

export const yesOrNoOptions = [
  {
    value: 1,
    label: "是",
  },
  {
    value: 0,
    label: "否",
  },
];

// 数据类型
export const valueSortOptions = [
  {
    value: 0,
    label: "数字型",
  },
  {
    value: 1,
    label: "字符型",
  },
];

// 配方类型
export const bomSortOptions = [
  {
    value: 1,
    label: "研究测试",
  },
  {
    value: 2,
    label: "生产定型",
  },
];

export const processingOptions = [
  {
    value: 0,
    label: "未开始",
  },
  {
    value: 1,
    label: "已开始",
  },
  {
    value: 2,
    label: "已结束",
  },
];

export const authOptions = [
  {
    value: 0,
    label: "未实名",
  },
  {
    value: 1,
    label: "已实名",
  },
];

export const orderStatusOptions = [
  {
    value: 0,
    label: "待支付",
  },
  {
    value: 1,
    label: "待提货",
  },
  {
    value: 2,
    label: "已完成",
  },
  {
    value: 3,
    label: "超时已关闭",
  },
];

export const disableStatusOptions = [
  {
    value: 0,
    label: "停用",
  },
  {
    value: 1,
    label: "启用",
  },
];

export const signStatusOptions = [
  {
    value: 1,
    label: "待买家上传",
  },
  {
    value: 2,
    label: "待卖家确认",
  },
  {
    value: 3,
    label: "待卖家上传",
  },
  {
    value: 4,
    label: "待买家确认",
  },
  {
    value: 5,
    label: "已完成",
  },
];

export const payChannelOptions = [
  {
    value: 2,
    label: "对公转账",
  },
  {
    value: 1,
    label: "现金",
  },
];

export const accountTypeListOptions = [
  {
    value: 1,
    label: "个人",
  },
  {
    value: 2,
    label: "公司",
  },
];

export const getMonth = (year, arr = []) => {
  return new Array(12)
    .fill(0)
    .map((item, index) => {
      const value = `${index + 1}`.padStart(2, "0");
      const label = year + value;
      return {
        value,
        label,
      };
    })
    .filter((item) => !arr.includes(item.label));
};

export function addArgument(fn, newArg) {
  if (fn) {
    return function (...args) {
      console.log("args===", args);
      return fn(...args, newArg);
    };
  }
  return null;
}

export const typeOptions = [
  {
    label: "不同应力",
    value: "不同应力",
  },
  {
    label: "松弛",
    value: "松弛",
  },
  {
    label: "老化",
    value: "老化",
  },
];
export const type2Options = [
  {
    label: "密度",
    value: "密度",
  },
  {
    label: "平均孔径",
    value: "平均孔径",
  },
  {
    label: "平均圆度",
    value: "平均圆度",
  },
];
export const typeLHOptions = [
  {
    label: "σ0.4",
    value: "σ0.4",
  },
  ...type2Options,
];
export const typeSCOptions = [
  { label: "压缩应变40%载荷", value: "压缩应变40%载荷" },
  ...type2Options,
];

export const filterUpType = (type) => {
  if (!type) return "yl";
  const obj = {
    不同应力: "yl",
    老化: "LH",
    松弛: "SC",
  };
  return obj[type];
};

export const randomColor = () => {
  return "#" + Math.random().toString(16).substring(2, 8).padEnd(6, "0");
};
